home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form ObliqueForm
- Appearance = 0 'Flat
- BackColor = &H00C0C0C0&
- Caption = "Oblique Projections"
- ClientHeight = 2835
- ClientLeft = 975
- ClientTop = 2100
- ClientWidth = 7470
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 3525
- KeyPreview = -1 'True
- Left = 915
- LinkTopic = "Form1"
- ScaleHeight = 2835
- ScaleWidth = 7470
- Top = 1470
- Width = 7590
- Begin VB.PictureBox Pict
- AutoRedraw = -1 'True
- Height = 2415
- Index = 2
- Left = 5040
- ScaleHeight = -6
- ScaleLeft = -3
- ScaleMode = 0 'User
- ScaleTop = 3
- ScaleWidth = 6
- TabIndex = 2
- Top = 0
- Width = 2415
- End
- Begin VB.PictureBox Pict
- AutoRedraw = -1 'True
- Height = 2415
- Index = 1
- Left = 2520
- ScaleHeight = -6
- ScaleLeft = -3
- ScaleMode = 0 'User
- ScaleTop = 3
- ScaleWidth = 6
- TabIndex = 1
- Top = 0
- Width = 2415
- End
- Begin VB.PictureBox Pict
- AutoRedraw = -1 'True
- Height = 2415
- Index = 0
- Left = 0
- ScaleHeight = -6
- ScaleLeft = -3
- ScaleMode = 0 'User
- ScaleTop = 3
- ScaleWidth = 6
- TabIndex = 0
- Top = 0
- Width = 2415
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- Caption = "Cabinet"
- Height = 255
- Index = 2
- Left = 5040
- TabIndex = 5
- Top = 2520
- Width = 2415
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- Caption = "Cavalier"
- Height = 255
- Index = 1
- Left = 2520
- TabIndex = 4
- Top = 2520
- Width = 2415
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- Caption = "Orthographic"
- Height = 255
- Index = 0
- Left = 0
- TabIndex = 3
- Top = 2520
- Width = 2415
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "ObliqueForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- ' Location of viewing eye.
- Dim EyeR As Single
- Dim EyeTheta As Single
- Dim EyePhi As Single
- ' Location of focus point.
- Const FocusX = 0#
- Const FocusY = 0#
- Const FocusZ = 0#
- Dim Projector(1 To 4, 1 To 4) As Single
- Dim CavProj(1 To 4, 1 To 4) As Single
- Dim CabProj(1 To 4, 1 To 4) As Single
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- Const Dtheta = PI / 20
- Select Case KeyCode
- Case vbKeyLeft
- EyeTheta = EyeTheta - Dtheta
-
- Case vbKeyRight
- EyeTheta = EyeTheta + Dtheta
-
- Case vbKeyUp
- EyePhi = EyePhi - Dtheta
-
- Case vbKeyDown
- EyePhi = EyePhi + Dtheta
-
- Case Else
- Exit Sub
- End Select
- m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
- TransformAllData Projector
- DrawAllData Pict(0), ForeColor, True
- End Sub
- Private Sub Form_Load()
- ' Initialize the eye position.
- EyeR = 3
- EyeTheta = PI * 0.4
- EyePhi = PI * 0.1
- ' Create the data.
- CreateData
- ' Create the projection matrices.
- m3PProject Projector, m3Perspective, EyeR, EyePhi, EyeTheta, FocusX, FocusY, FocusZ, 0, 1, 0
- m3ObliqueXY CavProj, 1#, PI / 6
- m3ObliqueXY CabProj, 0.5, PI / 6
- ' Project and draw the data.
- TransformAllData Projector
- DrawAllData Pict(0), ForeColor, True
- TransformAllData CavProj
- DrawAllData Pict(1), ForeColor, True
- TransformAllData CabProj
- DrawAllData Pict(2), ForeColor, True
- End Sub
- Sub CreateData()
- ' Create the axes.
- MakeSegment 0, 0, 0, 3, 0, 0 ' X axis.
- MakeSegment 0, 0, 0, 0, 3, 0 ' Y axis.
- MakeSegment 0, 0, 0, 0, 0, 3 ' Z axis.
- ' Create the object to display.
- MakeSegment 0, 0, 0, 2, 0, 0
- MakeSegment 2, 0, 0, 2, 2, 0
- MakeSegment 2, 2, 0, 0, 2, 0
- MakeSegment 0, 2, 0, 0, 0, 0
- MakeSegment 0, 0, 2, 2, 0, 2
- MakeSegment 2, 0, 2, 2, 2, 2
- MakeSegment 2, 2, 2, 0, 2, 2
- MakeSegment 0, 2, 2, 0, 0, 2
- MakeSegment 0, 0, 0, 0, 0, 2
- MakeSegment 2, 0, 0, 2, 0, 2
- MakeSegment 2, 2, 0, 2, 2, 2
- MakeSegment 0, 2, 0, 0, 2, 2
- End Sub
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
-